package View;

import javax.swing.*;

import model.*;

import javax.swing.GroupLayout.Alignment;

import Controller.AapController;
import javax.swing.LayoutStyle.ComponentPlacement;

public class AapView extends JFrame{
	
	public JButton btnVoortplanten = new JButton("Voortplanten");
	public JButton btnVerzorgen = new JButton("Verzorgen");
	
	Aap man_aap = new Aap(1, "henk",  "Dons", 500, 100, 100, true);
	Aap vrouw_aap = new Aap(1,"henk", "Dons", 400, 100, 100, false);
	Aap zuigeling = new Aap(1,"henk", "Dons", 300, 100, 100, false);
	
	
	public AapView() {
		setSize(500,344);		
		
		JButton btnBevallen = new JButton("Bevallen");
		
		GroupLayout groupLayout = new GroupLayout(getContentPane());
		groupLayout.setHorizontalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addContainerGap()
					.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING, false)
						.addComponent(btnBevallen, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
						.addComponent(btnVerzorgen, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
						.addComponent(btnVoortplanten, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
					.addContainerGap(379, Short.MAX_VALUE))
		);
		groupLayout.setVerticalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addContainerGap()
					.addComponent(btnVoortplanten)
					.addGap(18)
					.addComponent(btnVerzorgen)
					.addPreferredGap(ComponentPlacement.UNRELATED)
					.addComponent(btnBevallen)
					.addContainerGap(196, Short.MAX_VALUE))
		);
		getContentPane().setLayout(groupLayout);
		
		AapController ac = new AapController(vrouw_aap, man_aap, zuigeling);
		
		btnVoortplanten.addActionListener(ac);
		btnVoortplanten.setActionCommand("Voortplanten");
		btnVerzorgen.addActionListener(ac);
		btnVerzorgen.setActionCommand("Verzorgen");
		btnBevallen.addActionListener(ac);
		btnBevallen.setActionCommand("Bevallen");
	}
	
	private static AapView instance;
	
	public static AapView getInstance(){
		if(instance == null){
			instance = new AapView();
		}
		return instance;
	}
}
